package com.iemes.controller.mould;

import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.iemes.controller.index.BaseController;
import com.iemes.entity.MouldUnpassHandleFormMap;
import com.iemes.mapper.mould.MouldUnpassHandleMapper;
import com.iemes.plugin.PageView;
import com.iemes.util.Common;

@RequestMapping("/pAfterCheckReport/")
@Controller
public class PAfterCheckReportController extends BaseController {

	@Inject
	private MouldUnpassHandleMapper mouldUnpassHandleMapper;
	
	@RequestMapping("pCheckDaily_list")
	public String dList(Model model) throws Exception {
		model.addAttribute("res", findByRes());
		return Common.BACKGROUND_PATH + "/mould/pAfterCheckReport/pCheckDaily_list";
	}
	
	@ResponseBody
	@RequestMapping("pCheckDaily_findByPage")
	public PageView findByDPage(String pageNow, String pageSize) throws Exception 
	{
		MouldUnpassHandleFormMap mouldUnpassHandleFormMap=getFormMap(MouldUnpassHandleFormMap.class);
		List<Map<String, Object>> report = mouldUnpassHandleMapper.getAfterDaily(mouldUnpassHandleFormMap);
		LuogicPaging(pageNow, pageSize, report);
		return pageView;
	}
	
	@RequestMapping("pCheckUnqualified_list")
	public String uList(Model model) throws Exception {
		model.addAttribute("res", findByRes());
		return Common.BACKGROUND_PATH + "/mould/pAfterCheckReport/pCheckUnqualified_list";
	}
	
	//备模不合格统计
	@ResponseBody
	@RequestMapping("pCheckUnqualified_findByPage")
	public PageView findByUPage(String pageNow, String pageSize) throws Exception 
	{
		MouldUnpassHandleFormMap mouldUnpassHandleFormMap=getFormMap(MouldUnpassHandleFormMap.class);
		mouldUnpassHandleFormMap.put("checkResult",2);
		List<Map<String, Object>> report = mouldUnpassHandleMapper.getAfterDaily(mouldUnpassHandleFormMap);
		LuogicPaging(pageNow, pageSize, report);
		return pageView;
	}
}
